package com.hengxinguotong.zhihuichengjian.bean;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by liux on 2017/3/3.
 */

public class User implements Serializable {
    private String teamName;
    private String teamId;
    private String projectCompanyId;
    private String projectCompanyName;
    private int title = -1;
    private String name;
    private int workType = -1;
    private String workAge;
    private String positionWorktype;
    private String personId;
    private String headPortrait;
    private String smallHeadPortrait;//小头像是大头像名称 + "_100x100.png"
    private String sex;
    private String idCard;
    private String idCardBack;
    private String bloodType;
    private String iceContactName;
    private List<String> picList = new ArrayList<String>();//事故图片数组
    private String iceContactMobile;
    private String mobile;
    private String idCardFront;
    private String label;
    private String isLeader;//是否班组长 1是 0不是
    private String type;//证书类别
    private String number;//证书编号
    private String issueDate;
    private String validDate;
    private String issueOrgans;

    private int status = 0;//userList增加一个是否短信告知 0否 1是 ）
    private boolean checked = false;//是否被选中

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }

    public String getIssueDate() {
        return issueDate;
    }

    public void setIssueDate(String issueDate) {
        this.issueDate = issueDate;
    }

    public String getValidDate() {
        return validDate;
    }

    public void setValidDate(String validDate) {
        this.validDate = validDate;
    }

    public String getIssueOrgans() {
        return issueOrgans;
    }

    public void setIssueOrgans(String issueOrgans) {
        issueOrgans = issueOrgans;
    }

    public String getIsLeader() {
        return isLeader;
    }

    public void setIsLeader(String isLeader) {
        this.isLeader = isLeader;
    }

    public String getSmallHeadPortrait() {
        return smallHeadPortrait;
    }

    public void setSmallHeadPortrait(String smallHeadPortrait) {
        this.smallHeadPortrait = smallHeadPortrait;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public void setId(String id) {
        this.id = id;
    }

    private String userId;

    private String id;
    private String constructionId,
            constructionName,
            orgId;

    public String getId() {
        return id;
    }

    public String getConstructionId() {
        return constructionId;
    }

    public void setConstructionId(String constructionId) {
        this.constructionId = constructionId;
    }

    public String getConstructionName() {
        return constructionName;
    }

    public void setConstructionName(String constructionName) {
        this.constructionName = constructionName;
    }

    public String getOrgId() {
        return orgId;
    }

    public void setOrgId(String orgId) {
        this.orgId = orgId;
    }

    public int getTitle() {
        return title;
    }

    public void setTitle(int title) {
        this.title = title;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getWorkType() {
        return workType;
    }

    public void setWorkType(int workType) {
        this.workType = workType;
    }

    public String getWorkAge() {
        return workAge;
    }

    public void setWorkAge(String workAge) {
        this.workAge = workAge;
    }

    public String getPersonId() {
        return personId;
    }

    public void setPersonId(String personId) {
        this.personId = personId;
    }

    public String getHeadPortrait() {
        return headPortrait;
    }

    public void setHeadPortrait(String headPortrait) {
        this.headPortrait = headPortrait;
    }

    public String getPositionWorktype() {
        return positionWorktype;
    }

    public void setPositionWorktype(String positionWorktype) {
        this.positionWorktype = positionWorktype;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getIdCard() {
        return idCard;
    }

    public void setIdCard(String idCard) {
        this.idCard = idCard;
    }

    public String getIdCardBack() {
        return idCardBack;
    }

    public void setIdCardBack(String idCardBack) {
        this.idCardBack = idCardBack;
    }

    public String getBloodType() {
        return bloodType;
    }

    public void setBloodType(String bloodType) {
        this.bloodType = bloodType;
    }

    public String getIceContactName() {
        return iceContactName;
    }

    public void setIceContactName(String iceContactName) {
        this.iceContactName = iceContactName;
    }

    public List<String> getPicList() {
        return picList;
    }

    public void setPicList(List<String> picList) {
        this.picList = picList;
    }

    public String getIceContactMobile() {
        return iceContactMobile;
    }

    public void setIceContactMobile(String iceContactMobile) {
        this.iceContactMobile = iceContactMobile;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getIdCardFront() {
        return idCardFront;
    }

    public void setIdCardFront(String idCardFront) {
        this.idCardFront = idCardFront;
    }

    @Override
    public boolean equals(Object o) {
        User user = (User) o;
        if(id == null){
            if(user == null || user.getUserId() == null){
                return false;
            }

            if (this.userId.equals(user.getUserId())) {
                return true;
            }
        }else {
            if(user == null || user.getId() == null){
                return false;
            }

            if (this.id.equals(user.getId())) {
                return true;
            }
        }
        return false;
    }

    public boolean isOnePerson(User user) {
        if(id == null){
            if (this.userId == null) {
                return false;
            }

            if (this.userId.equals(user.getUserId())) {
                return true;
            }
        }else {
            if (this.id == null) {
                return false;
            }

            if (this.id.equals(user.getId())) {
                return true;
            }
        }
        return false;
    }

    public boolean isInUsers(List<User> users) {
        if (users == null) {
            return false;
        }
        if (users.size() == 0) {
            return false;
        }
        for (int i = 0; i < users.size(); i++) {
            if (this.isOnePerson(users.get(i))) {
                return true;
            }
        }
        return false;
    }


    public void isInUsersRemoved(List<User> users) {
        for (int i = 0; i < users.size(); i++) {
            if (this.isOnePerson(users.get(i))) {
                users.remove(i);
            }
        }
    }

    public String getTeamName() {
        return teamName;
    }

    public void setTeamName(String teamName) {
        this.teamName = teamName;
    }

    public String getProjectCompanyId() {
        return projectCompanyId;
    }

    public void setProjectCompanyId(String projectCompanyId) {
        this.projectCompanyId = projectCompanyId;
    }

    public String getProjectCompanyName() {
        return projectCompanyName;
    }

    public void setProjectCompanyName(String projectCompanyName) {
        this.projectCompanyName = projectCompanyName;
    }

    public String getTeamId() {
        return teamId;
    }

    public void setTeamId(String teamId) {
        this.teamId = teamId;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public boolean isChecked() {
        return checked;
    }

    public void setChecked(boolean checked) {
        this.checked = checked;
    }
}
